package com.waitingresult.ljt.service;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.waitingresult.common.base.service.BaseService;
import com.waitingresult.ljt.entity.Black;
import com.waitingresult.ljt.qo.BlackQo;

/**
 * All right reserved,Designed By WangShuai
 *
 * @author : WangShuai
 * @version : V1.0
 * @ClassName : BlackService
 * @Description :
 * @date : 2021/11/23 23:41
 */
public interface BlackService extends BaseService<Black, BlackQo> {

    /**
     * 获取默认的条件构造
     *
     * @param qo 入参
     * @return SQl条件构造器
     */
    @Override
    default LambdaQueryWrapper<Black> getLamdaQueryWrapper(BlackQo qo) {
        return new LambdaQueryWrapper<Black>()
                .eq(ObjectUtil.isNotNull(qo.getId()), Black::getId, qo.getId())
                .eq(ObjectUtil.isNotNull(qo.getUserId()), Black::getUserId, qo.getUserId())
                .like(StrUtil.isNotEmpty(qo.getName()), Black::getName, qo.getName())
                .like(StrUtil.isNotEmpty(qo.getMobile()), Black::getMobile, qo.getMobile());
    }

}
